package com.ruoyi.order.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.order.domain.SyProductReturn;
import com.ruoyi.order.mapper.SyProductReturnMapper;
import com.ruoyi.order.service.ISyProductReturnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 商品退货及退款Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-12-19
 */
@Service
public class SyProductReturnServiceImpl implements ISyProductReturnService
{
    @Autowired
    private SyProductReturnMapper syProductReturnMapper;

    /**
     * 查询商品退货及退款
     * 
     * @param orderId 商品退货及退款主键
     * @return 商品退货及退款
     */
    @Override
    public SyProductReturn selectSyProductReturnByOrderId(String orderId)
    {
        return syProductReturnMapper.selectSyProductReturnByOrderId(orderId);
    }

    /**
     * 查询商品退货及退款列表
     * 
     * @param syProductReturn 商品退货及退款
     * @return 商品退货及退款
     */
    @Override
    public List<SyProductReturn> selectSyProductReturnList(SyProductReturn syProductReturn)
    {
        return syProductReturnMapper.selectSyProductReturnList(syProductReturn);
    }

    /**
     * 新增商品退货及退款
     * 
     * @param syProductReturn 商品退货及退款
     * @return 结果
     */
    @Override
    public int insertSyProductReturn(SyProductReturn syProductReturn)
    {
        syProductReturn.setCreateTime(DateUtils.getNowDate());
        return syProductReturnMapper.insertSyProductReturn(syProductReturn);
    }

    /**
     * 修改商品退货及退款
     * 
     * @param syProductReturn 商品退货及退款
     * @return 结果
     */
    @Override
    public int updateSyProductReturn(SyProductReturn syProductReturn)
    {
        syProductReturn.setUpdateTime(DateUtils.getNowDate());
        return syProductReturnMapper.updateSyProductReturn(syProductReturn);
    }

    /**
     * 批量删除商品退货及退款
     * 
     * @param orderIds 需要删除的商品退货及退款主键
     * @return 结果
     */
    @Override
    public int deleteSyProductReturnByOrderIds(String[] orderIds)
    {
        return syProductReturnMapper.deleteSyProductReturnByOrderIds(orderIds);
    }

    /**
     * 删除商品退货及退款信息
     * 
     * @param orderId 商品退货及退款主键
     * @return 结果
     */
    @Override
    public int deleteSyProductReturnByOrderId(String orderId)
    {
        return syProductReturnMapper.deleteSyProductReturnByOrderId(orderId);
    }

    @Override
    public int productReturnAll() {
        return syProductReturnMapper.productReturnAll();
    }
}
